import React from 'react';

import Constants from '../../common/Constants';
import CommonSendFetchAction from '../common/CommonSendFetchAction';

//请求帖子列表
export default class NewsSendCommentListAction extends CommonSendFetchAction {
  constructor(props){
    super(props);
    this.moduleType = Constants.MODULE_TYPE.NEWS;
    this.name = "NewsSendCommentListAction";
  }
  _dealCall(caller, data) {
    caller.setState({
      commentLoading:true,
    })
  }
  _dealFinishSucess(data, response) {
    this.caller.setState({
      commentData:[data],
      commentLoading:false,
      commentLoadComplete:true,
      statusText:"",
    })
  }
   _dealFinishFailed(data, response) {
    let detail = "服务器错误";
    if(data && data.detail != undefined) {
      detail = data.detail;
    }
    detail = detail + " " + response.status;
    this.caller.setState({
      commentLoading:false,
      commentLoadComplete:true,
      statusText:detail,
      commentData:[],
    })
  }
}
